<{include file="header.htm"}>
<style>
    .input_group_input {
        background: none;
        width: 100%;
        padding: 0.8em 10px 0.8em 0.8em;
        box-sizing: border-box;
        height: 45px;
        font-size: 14px;
        color: #333;
        text-align: left;
    }
    input[type='password'] {
        border: none;
        outline: none;
    }
</style>
<body>
<header>
    <div class="header_top">
        <div class="st_back"><a href="javascript:window.history.back();"></a></div>
        <h1 class="tit">手机验证</h1>
        <a class="top_user_reg" href="<{$config.weburl}>/login.php">登录</a>
    </div>
</header>
 <div class="mid_content">
        <div class="st_user_box">
  <form action="oauth.php" method="post" onsubmit=" return check_data();">
      <input type="hidden" name="action" value="mobile_submit"/>
      <input type="hidden" name="connect_id" value="<{$connect_id}>" />
      <div class="login_page clearfix number_password">
        <p><strong>手机号：</strong><input type="text" class="username" value="" name="mobile" id="mobile" placeholder="请输入手机号" /></p>
          <p><strong>验证码：</strong></strong><input type="text" class="yzm_txt focus" id="code" name="code"  value="" placeholder="验证码"   />

              <span style=" display: block; width: 60px; height: 48px; line-height: 48px; text-align: center; background:#e77817; color: #fff; font-size: 12px; cursor: pointer;" id="sendCode">发送</span>

          </p>

      </div>
       <p  class="submit_btn"><input class="login_in" name="" type="submit" value="立即验证"></p>
  </form>


</div>
</div>

<script type="text/javascript">

    function  check_data(){
        var mobile = $("#mobile").val();
        var code = $("#code").val();
        var mobile_part = /^1\d{10}$/;
        if(mobile == ''){
            alert("请填写手机号");
            return false;
        } else if(!mobile_part.test(mobile)){
            alert("请填写正确的手机号");
            return false;
        } else if(code == '' ){
            alert("请填写短信验证码");
            return false;
        } else {
            return true;
        }

    }

    function settime(val) {
        if (val == 0) {
            $("#sendCode").removeClass("on");
            $("#sendCode").html("点击发送");
            return false;
        } else {
            if(val == ''){
                val = 60;
            }
            $("#sendCode").html(val + 's');
            val--;
            $("#sendCode").addClass("on");
        }
        setTimeout(function() {
            settime(val)
        },1000)
    }

    //发送短信
    $("#sendCode").on("click",function(){
        var mobile = $("#mobile").val();
        var mobile_part = /^1\d{10}$/;
        if(mobile == ''){
            alert("请填写手机号");
            return false;
        } else if(!mobile_part.test(mobile)){
            alert("请填写正确的手机号");
            return false;
        } else {
            if($(this).hasClass("on")){
                return false;
            }
            $.post("ajax_back_end.php",{action:'sendSms',mobile:mobile},function(ret){
                ret = eval('('+ret+')');
                if(!ret.status){
                    alert(ret.msg);
                } else {
                    settime(60);
                }
            });
        }
    });

</script>

<{include file="footer.htm"}>
